package com.wzg.jetpack_blackbox.login.source;

import com.wzg.jetpack_blackbox.base.INetWorkCallback;
import com.wzg.jetpack_blackbox.login.entity.LoginEntity;
import com.wzg.jetpack_blackbox.login.source.ILoginNetWorkDataSource;

public class LoginNetWorkDataSource implements ILoginNetWorkDataSource {
    @Override
    public void login(String name, String pwd, INetWorkCallback<LoginEntity> callback) {
        //do network...
        //这里跟后台交互，得到结果，但是这个app没有涉及到后台

        if (name != null && name.length() > 1 && pwd != null && pwd.length() > 1) {
            LoginEntity loginEntity = new LoginEntity();
            loginEntity.setLoginName(name);
            loginEntity.setToken(name + pwd);
            callback.onSuccess(loginEntity);
        } else {
            callback.onFailed("用户的账号和密码需至少1位数");
        }


    }
}
